package Index_PKG;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class IndexServlet
 */
public class IndexServlet extends HttpServlet
	{
		private static final long serialVersionUID = 1L;
		private static PrintWriter out;

		protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
			{
				doPost(request, response);
			}

		protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
			{
				out = response.getWriter();

				HtmlGenerator.createBodyHeadHtml(out, "./CSS/StyleSheet.css", "Login", "./JavaScript/gestion.js");
				HtmlGenerator.createFormulaire(out, "Lotto");
				HtmlGenerator.createTable(out, null, "TAB_nbrs");

				for (int i = 1; i < 43; i++)
					{
						if ((i == 1) || (i == 11) || (i == 21) || (i == 31) || (i == 41))
							HtmlGenerator.createTableRow(out, "tr" + i);

						HtmlGenerator.createTableColumn(out, Integer.toString(i), Integer.toString(i));
						HtmlGenerator.createCheckBox(out, Integer.toString(i), Integer.toString(i));
						HtmlGenerator.closeTableColumn(out);

						if ((i == 10) || (i == 20) || (i == 30) || (i == 40) || (i == 50))
							HtmlGenerator.closeTableRow(out);
					}

				HtmlGenerator.closeTable(out);
				HtmlGenerator.createSubmitButton(out, "Valider la grille", "BT_submit", "onmouseover=\"ChangeButtonColor(this);\"  onmouseout=\"ReinitButtonColor(this);\"");
				HtmlGenerator.closeFormulaire(out);
				HtmlGenerator.closeEndBodyHeadHtml(out);

			}

	}
